﻿using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
using System;
using System.Collections.Generic;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{

    public partial class VGLLG
    {
        private VGPBST _VGB;
        public VGPBST VGB
        {
            get
            {
                if (_VGB == null) _VGB = new VGPBST();
                return _VGB;
            }
        }
        private VGABEW _VBW;
        public VGABEW VBW
        {
            get
            {
                if (_VBW == null) _VBW = new VGABEW();
                return _VBW;
            }
        }
        private VGPDAT _VGP;
        public VGPDAT VGP
        {
            get
            {
                if (_VGB == null) _VGP = new VGPDAT();
                return _VGP;
            }
        }
        private VVKPOS _VKP;
        public VVKPOS VKP
        {
            get
            {
                if (_VKP == null) _VKP = new VVKPOS();
                return _VKP;
            }
        }
        private VGAAUF _VGD;
        public VGAAUF VGD
        {
            get
            {
                if (_VGD == null) _VGD = new VGAAUF();
                return _VGD;
            }
        }
        public readonly static VGLLG Instance = new VGLLG();
        private string _CART; public string CART { get { return _CART; } set { _CART = value; OnPropertyChanged("CART", value); } }
        private string _EXCLUDEWH; public string EXCLUDEWH { get { return _EXCLUDEWH; } set { _EXCLUDEWH = value; OnPropertyChanged("EXCLUDEWH", value); } }

        private bool _FTREQ; public bool FTREQ { get { return _FTREQ; } set { _FTREQ = value; OnPropertyChanged("FTREQ", value); } }
        private bool _ALLCOATE; public bool ALLCOATE { get { return _ALLCOATE; } set { _ALLCOATE = value; OnPropertyChanged("ALLCOATE", value); } }
        
        public double _REQ = 0.0;
        public double REQ
        { get { return _REQ; } set { _REQ = value; OnPropertyChanged("REQ", value); } } //lENGth 0
        public double _KG1 = 0.0;
        public double KG1
        { get { return _KG1; } set { _KG1 = value; OnPropertyChanged("KG1", value); } } //lENGth 0  public double _KG1 = 0.0;

        public double _KG2 = 0.0;
        public double KG2
        { get { return _KG2; } set { _KG2 = value; OnPropertyChanged("KG2", value); } } //lENGth 0  public double _KG2 = 0.0;


        public double _KG3 = 0.0;
        public double KG3
        { get { return _KG3; } set { _KG3 = value; OnPropertyChanged("KG3", value); } } //lENGth 0  public double _KG3 = 0.0;
        public double _KG5 = 0.0;
        public double KG5
        { get { return _KG5; } set { _KG5 = value; OnPropertyChanged("KG5", value); } } //lENGth 0

        public void RVZUTEI(DataRow dwGD)
        {
            if (dwGD == null)
            {
                return;
            }
            double GAKG1 = Convert.ToDouble(dwGD["GAKG1"].ToString());
            double GAKG2 = Convert.ToDouble(dwGD["GAKG2"].ToString());

            double GAKG3 = Convert.ToDouble(dwGD["GAKG3"].ToString());
            double GAKG5 = Convert.ToDouble(dwGD["GAKG5"].ToString());
            dwGD["GAKG3"] = 0;
            dwGD["GAKG5"] = 0;
            dwGD["GABEM"] = " ".PadRight(40);
            DataSet SZUTEI = ZU.QZU09(dwGD);
            foreach (DataRow dwZU in SZUTEI.Tables[0].Rows)
            {
                ZU.DeleteZUTEI(dwZU, 1);
                GBW.NWBBEW(dwZU, "62", this.RUNID);
                SResult = GPB.QueryGPBST(dwZU, 2);
                foreach (DataRow row in SResult.Tables[0].Rows)
                {
                    GPB.UGB03(row);
                }
            }
            GU.UGD14(dwGD);
            dwData = VABP.TBMain.NewRow();
            dwData["ABPMANDANT"] = app.Mandant;
            dwData["ABPAUFKRS"] = dwGD["GAAUFKRS"];
            dwData["ABPAUFLFD"] = dwGD["GAAUFLFD"];
            dwData["ABPAUFPOS"] = dwGD["GAAUFPOS"];
            VABP.UABP06(dwData);
        }
        /// <summary>
        /// 自动修复现有的留位记录
        /// 1.首先前面计算更新了需求数量
        /// 2.根据留位的箱子，进行计算
        /// 3.如果仅有一箱，根据当前箱若留位>新需求，则扣减，否则不处理
        /// 4.若是多箱，首先删除本留位，逐箱进行计算，这个箱子能满足部分或全部要求，则继续留位。便利所有的箱子，多余的删除。如果已经满足要求，则返回，若是不满足需求，则继续留位。
        /// </summary>
        /// <param name="dwGD"></param>
        public void REDUCEZUTEI(DataRow dwGD)
        {
            if (dwGD == null)
            {
                return;
            }
             
            double GAKG1 = Convert.ToDouble(dwGD["GAKG1"].ToString());
            double GAKG2 = Convert.ToDouble(dwGD["GAKG2"].ToString());

            double GAKG3 = Convert.ToDouble(dwGD["GAKG3"].ToString());
            double GAKG5 = Convert.ToDouble(dwGD["GAKG5"].ToString());
            if (GAKG1 - (GAKG3 + GAKG5) >= 0)//需求数量比留位数量多，返回
                return;
            dwGD["GAKG3"] = 0;
            dwGD["GAKG5"] = 0;
            dwGD["GABEM"] = " ".PadRight(40);
            DataSet SZUTEI = ZU.QZU09(dwGD); //留位清单
            foreach (DataRow dwZU in SZUTEI.Tables[0].Rows)
            {
                GAKG3 = Convert.ToDouble(dwGD["GAKG3"].ToString());
                GAKG5 = Convert.ToDouble(dwGD["GAKG5"].ToString());
                //先删除留位==本箱
                ZU.DZU03(dwZU);
                GBW.NWBBEW(dwZU, "62", this.RUNID); 
                double ZUEINTKG= 100*0.001*Convert.ToDouble(dwZU["ZUEINTKG"].ToString());
                SResult = GPB.QGPB02(dwZU);
                double diff = GAKG1 - (GAKG3 + GAKG5);
                //看看是否还需要留位
                if (diff == 0)//不需要留位
                {
                    foreach (DataRow row in SResult.Tables[0].Rows)
                    {
                        GPB.UGB03(row);
                    }
                    continue;
                }
                if(ZUEINTKG<= diff)
                {
                    //此箱不能满足全部要求，则使用本箱数量全部留位
                    GLLGALLOCATE(dwGD, dwZU, ZUEINTKG/100);
                } 
                else
                {
                    //若能满足要求，则仅仅留位部分数量
                    GLLGALLOCATE(dwGD, dwZU, diff/100);
                }     
                foreach (DataRow row in SResult.Tables[0].Rows)
                {
                    GPB.UGB03(row);
                }
            } 
        }
        public void GLLGALLOCATE(DataRow dwGD,DataRow dwGB,double QTYR = 0)
        {
            try
            {                
                dwGD["GAVAR"] = Helper.Left(dwGD["GAVAR"].ToString().PadRight(3), 3);
                string GLLBEHI = dwGB["GLLBEHI"].ToString();

                string GPBPARTIE = dwGB["GPBPARTIE"].ToString();
                string GPSPPART = dwGB["GPSPPART"].ToString();
                string GPFBPART = dwGB["GPFBPART"].ToString();
                string LPLBKZ = dwGB["LPLBKZ"].ToString();
                if (LPLBKZ.Trim() == "L")
                    LPLBKZ = "S";

                double GPBBSTKGZ = Convert.ToDouble(dwGB["GPBBSTKGZ"].ToString());

                double KG = Convert.ToDouble(dwGB["KG"].ToString());
                double FREEKG = Convert.ToDouble(dwGB["FREEKG"].ToString());
                double ALLOKG = Convert.ToDouble(dwGB["ALLOKG"].ToString());
                double GAKG1 = Convert.ToDouble(dwGD["GAKG1"].ToString());
                double GAKG2 = Convert.ToDouble(dwGD["GAKG2"].ToString());
                double GAKG3 = Convert.ToDouble(dwGD["GAKG3"].ToString());
                double GAKG5 = Convert.ToDouble(dwGD["GAKG5"].ToString());
                double REQ = Helper.RoundX((GAKG1 - GAKG2 - GAKG3 - GAKG5) / 100, 1000);
                if (QTYR > 0)
                    REQ = QTYR;

                if (REQ <= 0)
                    return;
                #region===dwZUTEI========
                PM["ORDERNUM"] = dwGD["GAAUFKRS"].ToString() + dwGD["GAAUFLFD"].ToString() + dwGD["GAAUFPOS"].ToString() + dwGD["GAPOS"].ToString() + dwGD["GASA"].ToString();
                PM["CART"] = dwGD["GAART"].ToString() + dwGD["GAVAR"].ToString() + dwGD["GAFARBE"].ToString();
                PM["LPLBKZ"] = LPLBKZ;
                PM["GPBPARTIE"] = GPBPARTIE;
                PM["GPBPARTIEKZ"] = dwGB["GPBPARTIEKZ"];
                PM["LO"] = dwGB["GLLO"];
                PM["LB"] = dwGB["GLLB"];
                PM["GLLBEHI"] = GLLBEHI;
                PM["GPSPPART"] = dwGB["GPSPPART"];
                if (FREEKG < QTYR)
                {
                    throw new Exception("本批次数量小于指定数量");
                }
                #endregion
                #region====FREEKG > REQ======
                if (FREEKG <= REQ)
                {
                    //需求100，此箱50
                    REQ = FREEKG;
                }
                ALLOKG += REQ;
                FREEKG -= REQ;
                GPBBSTKGZ += REQ * 1000;
                dwGB["ALLOKG"] = ALLOKG;
                dwGB["FREEKG"] = FREEKG;
                dwGB["GPBBSTKGZ"] = GPBBSTKGZ;
                PM["ZUEINTKG"] = REQ * 1000;

                if (LPLBKZ == "P")
                {
                    GAKG5 += REQ * 100;
                }
                else
                {
                    GAKG3 += REQ * 100;
                }
                dwGD["GAKG3"] = GAKG3;
                dwGD["GAKG5"] = GAKG5;
                string current = dwGD["GABEM"].ToString();
                if (GPFBPART.Trim().Length < 3)
                {
                    dwGD["GABEM"] = dwGB["GPSPPART"];
                }
                else
                {
                    dwGD["GABEM"] = dwGB["GPFBPART"];
                }
                if (current.Trim().Length > 0)
                {
                    if (current.Trim() != dwGD["GABEM"].ToString().Trim())
                    {
                        //throw new Exception("请选择相同的批次");
                    }
                }
                ZU.NEWZUTEI(PM);
                RESETREQ(dwGD);
                #endregion

                VGB.UpdateGPBST(dwGB, 3);
                GU.UpdateGAAUF(dwGD, 1);
                dwData = VABP.TBMain.NewRow();
                dwData["ABPMANDANT"] = dwGD["GAMANDANT"];
                dwData["ABPAUFKRS"] = dwGD["GAAUFKRS"];
                dwData["ABPAUFLFD"] = dwGD["GAAUFLFD"];
                dwData["ABPAUFPOS"] = dwGD["GAAUFPOS"];
                VABP.UABP06(dwData);
            }
            catch (Exception ex)
            { 
                Tracer.Error(ex.StackTrace, ex);
            }
        }
        public void RESETREQ(DataRow dwGD)
        {
            if (dwGD == null)
            {
                KG1 = 0;
                KG2 = 0;
                KG3 = 0;
                KG5 = 0;
                REQ = 0;
                FTREQ = false;
                ALLCOATE = true;
            }
            else
            {
                KG1 = Convert.ToDouble(dwGD["GAKG1"].ToString());
                KG2 = Convert.ToDouble(dwGD["GAKG2"].ToString());
                KG3 = Convert.ToDouble(dwGD["GAKG3"].ToString());
                KG5 = Convert.ToDouble(dwGD["GAKG5"].ToString());
                REQ = KG1 - KG3 - KG5;
                dwGD["GAKG0"] = REQ;
                if (REQ > 0)
                {
                    ALLCOATE = true;
                }
                else
                {
                    ALLCOATE = false;
                }
                if (KG3 != 0 || KG5 != 0)
                {
                    FTREQ = false;
                }
                else
                {
                    FTREQ = true;
                }
            }
            if (dwMaster == null)
                return;
        }
        public DataSet GBDLOAD(string partie, string kz)
        {

            if (partie.Length < 10)
                return null;
            dwData = TBMain.NewRow();
            dwData["GLMANDANT"] = app.Mandant;
            dwData["GLPARTIE"] = partie;
            dwData["GLPARTIEKZ"] = kz;
            SResult = QGLLG10(dwData);
            return SResult;

        }
        public void BATCHWBCHG()
        {
            if (TBTemp == null)
                return;
            foreach (DataRow _dwWB in TBMain.Rows)
            {
                filter = "GLLBEH='" + _dwWB["GLLBEH"].ToString() + "'";
                rows = TBTemp.Select(filter);
                if (rows.Length == 0) continue;
                if (rows[0]["GLBEM"].ToString()
                   != _dwWB["GLBEM"].ToString())
                {
                    UGLLG04(_dwWB);
                }
                if (rows[0]["GLBSTKG"].ToString().Trim() != _dwWB["GLBSTKG"].ToString().Trim())
                {
                    CHGQTY(rows[0], Convert.ToDouble(_dwWB["GLBSTKG"].ToString()), Convert.ToDouble(_dwWB["GLBSTNET"].ToString()));
                }
            }

        }
        public void CHGQTY(DataRow _dwWB, double CQTY, double CNET)
        {
            //_dwWB原始值
            double BQTY = System.Convert.ToDouble(_dwWB["GLBSTKG"].ToString());
            double BNET = System.Convert.ToDouble(_dwWB["GLBSTNET"].ToString());

            _dwWB["GLBSTKG"] = CQTY;
            _dwWB["GLBSTNET"] = CQTY;
            _dwWB["GLPRODDAT"] = date;
            UpdateGLLG(_dwWB, 7);
            dwData = TBMain.NewRow();
            dwData.ItemArray = _dwWB.ItemArray;

            dwData["GLBSTKG"] = Math.Abs(BQTY - CQTY);
            dwData["GLBSTNET"] = Math.Abs(BNET - CNET);
            if (BQTY > CQTY)
            {
                GBW.NWBBEW(dwData, "42", RUNID);
            }
            else
            {
                GBW.NWBBEW(dwData, "43", RUNID);
            }
        }

        public void NEWGLLG(Dictionary<string, object> pm)
        {
            IsEdit = true;
            IsKEY = true;

            if (LO.Length < 2)
                return;
            if (LB.Length < 2)
                return;
            if (LP.Length < 8)
                return;

            dwData = TBMain.NewRow();
            SetUpNewRow(ref dwData);
            LFD = VSDDAT.SD22.GETNEXT("0022", "AB", "GLLBEHI", 1, 10);
            string _time = "";
            string _date = "";
            Helpers.Helper.GetTime(ref _date, ref _time);
            dwData["GLPARTIE"] = (string)pm["PARTIE"];
            dwData["GLPARTIEKZ"] = (string)pm["KZ"];
            dwData["GLLO"] = (string)pm["LO"];
            dwData["GLLB"] = (string)pm["LB"];
            dwData["GLLP"] = (string)pm["LP"];
            dwData["GLAUFMSL"] = (string)pm["MU"];
            dwData["GLLBEH"] = LFD;
            dwData["GLLBEHI"] = LFD;

            dwData["GLENTDAT"] = _date;
            dwData["GLENTZEIT"] = _time;
            dwData["GLUBDAT"] = _date;
            dwData["GLUBZEIT"] = _time;
            TBMain.Rows.InsertAt(dwData, 0);
            InsertGLLG(dwData, app.company);
        }
        public DataTable NEWMBOX(Dictionary<string, object> pm)
        {

            DataTable TBGB = TBMain.Clone();
            TBGB.TableName = TableName;
            int BOX = (int)pm["BOX"];
            double QTY = (double)pm["QTY"];
            string LO = (string)pm["LO"];
            string LB = (string)pm["LB"];
            string LP = (string)pm["LP"];
            string PARTIE = (string)pm["PARTIE"];
            string KZ = (string)pm["KZ"];

            double BQTY = Helper.RoundX(QTY / BOX, 10);
            string _time = "";
            string _date = "";
            Helpers.Helper.GetTime(ref _date, ref _time); 
            for (int i = 1; i <= BOX; i++)
            {
                dwData = TBGB.Rows.Add();
                SetUpNewRow(ref dwData);
                LFD = VSDDAT.SD22.GETNEXT("0022", "AB", "GLLBEHI", 1, 10);
                dwData["GLPARTIE"] = (string)pm["PARTIE"];
                dwData["GLPARTIEKZ"] = (string)pm["KZ"];
                dwData["GLLO"] = (string)pm["LO"];
                dwData["GLLB"] = (string)pm["LB"];
                dwData["GLLP"] = (string)pm["LP"];
                dwData["GLAUFMSL"] = (string)pm["MU"];
                dwData["GLLBEH"] = LFD;
                dwData["GLLBEHI"] = LFD;
                dwData["GLBSTKG"] = BQTY*1000;
                dwData["GLTARA"] =0;
                dwData["GLBSTNET"] = BQTY * 1000;
                dwData["GLENTDAT"] = _date;
                dwData["GLENTZEIT"] = _time;
                dwData["GLUBDAT"] = _date;
                dwData["GLUBZEIT"] = _time;
            }

           string BELEG = VSDDAT.SD22.GETNEXT("0022", "  ", "BEWEGUNG", 2);
            int LFDNR = 1;
            DataRow dwNBW =VBW.TBMain.NewRow();
            VBW.SetUpNewRow(ref dwNBW);

            foreach (DataRow dwGB in TBGB.Rows)
            {
                BATCHWB14(dwGB);
                PM["ZUTEI"] = dwGB;
                PM["BELEG"] = BELEG;
                PM["LFDNR"] = LFDNR++;
                PM["BEWBS"] = "11";
                PM["RUNID"] = RUNID;
                PM["ART"] = pm["ART"];
                PM["VAR"] = pm["VAR"];
                PM["FARBE"] = pm["FARBE"];
                VBW.NWBBEW(dwNBW, pm,false);
            }
            POSTCHG();
            VBW.POSTCHG();
            return TBGB;
        }

        public void GB15BATCH(Dictionary<string, object> pm)
        {
            DataTable TB = pm["TBGB"] as DataTable;
            foreach (DataRow dwWBM in TB.Rows)
            {
                BATCHWB14(dwWBM);
                PM["PARTIE"] = dwWBM["GLPARTIE"].ToString();
                PM["KZ"] = dwWBM["GLPARTIEKZ"].ToString();
            }
            POSTCHG();
            PM["ORDERNUM"] = pm["ORDERNUM"];
            PM["AUFTYP"] = pm["AUFTYP"];
            PM["KRS"] = pm["KRS"];
            PM["LFD"] = pm["LFD"];
            PM["POS"] = pm["POS"]; 
            GPB.BOXCHG(PM);
            VGP.BOXCHG(PM);
        }
    }
    public partial class VGLLG
    {
        private VABPOS _VABP;

        public VABPOS VABP
        {
            get
            {
                if (_VABP == null) _VABP = new VABPOS();
                return _VABP;
            }
        }
        private VGAAUF _GU;

        public VGAAUF GU
        {
            get
            {
                if (_GU == null) _GU = new VGAAUF();
                return _GU;
            }
        }
        private VGABEW _GBW;

        public VGABEW GBW
        {
            get
            {
                if (_GBW == null) _GBW = new VGABEW();
                return _GBW;
            }
        }
        private VGPBST _GPB;

        public VGPBST GPB
        {
            get
            {
                if (_GPB == null) _GPB = new VGPBST();
                return _GPB;
            }
        }
        private VZUTEI _ZU;

        public VZUTEI ZU
        {
            get
            {
                if (_ZU == null) _ZU = new VZUTEI();
                return _ZU;
            }
        }
        public string GLLO { get { if (dwMaster == null) return ""; return dwMaster["GLLO"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLLO"] = value; OnPropertyChanged("GLLO", value); } } //lENGth 2
        public string GLLB { get { if (dwMaster == null) return ""; return dwMaster["GLLB"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLLB"] = value; OnPropertyChanged("GLLB", value); } } //lENGth 2
        public string GLLP { get { if (dwMaster == null) return ""; return dwMaster["GLLP"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLLP"] = value; OnPropertyChanged("GLLP", value); } } //lENGth 8
        public string GLBEM { get { if (dwMaster == null) return ""; return dwMaster["GLBEM"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLBEM"] = value; OnPropertyChanged("GLBEM", value); } } //lENGth 40
        public double GLBSTKG { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["GLBSTKG"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLBSTKG"] = value; OnPropertyChanged("GLBSTKG", value); } } //lENGth 0
        public double GLBSTKA { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["GLBSTKA"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLBSTKA"] = value; OnPropertyChanged("GLBSTKA", value); } } //lENGth 0
        public double GLBSTSP { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["GLBSTSP"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLBSTSP"] = value; OnPropertyChanged("GLBSTSP", value); } } //lENGth 0
        public double GLBSTNET { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["GLBSTNET"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLBSTNET"] = value; OnPropertyChanged("GLBSTNET", value); } } //lENGth 0
        public double GLTARA { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["GLTARA"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLTARA"] = value; OnPropertyChanged("GLTARA", value); } } //lENGth 0
        public double GLHUELGEW { get { if (dwMaster == null) return 0.0; return Convert.ToDouble(dwMaster["GLHUELGEW"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLHUELGEW"] = value; OnPropertyChanged("GLHUELGEW", value); } } //lENGth 0
        public string GLLBEH { get { if (dwMaster == null) return ""; return dwMaster["GLLBEH"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLLBEH"] = value; OnPropertyChanged("GLLBEH", value); } } //lENGth 10
        public string GLLBEHI { get { if (dwMaster == null) return ""; return dwMaster["GLLBEHI"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLLBEHI"] = value; OnPropertyChanged("GLLBEHI", value); } } //lENGth 10
        public string GLFILLER1 { get { if (dwMaster == null) return ""; return dwMaster["GLFILLER1"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLFILLER1"] = value; OnPropertyChanged("GLFILLER1", value); } } //lENGth 39
        public string GLAUFMSL { get { if (dwMaster == null) return ""; return dwMaster["GLAUFMSL"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLAUFMSL"] = value; OnPropertyChanged("GLAUFMSL", value); } } //lENGth 2

        #region======ColumnSchema==========
        /*
                 public string GLMANDANT { get { if (dwMaster == null) return ""; return dwMaster["GLMANDANT"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLMANDANT"] = value; OnPropertyChanged("GLMANDANT", value); } } //lENGth 2
                 public string GLPARTIE { get { if (dwMaster == null) return ""; return dwMaster["GLPARTIE"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLPARTIE"] = value; OnPropertyChanged("GLPARTIE", value); } } //lENGth 7
                 public string GLPARTIEKZ { get { if (dwMaster == null) return ""; return dwMaster["GLPARTIEKZ"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLPARTIEKZ"] = value; OnPropertyChanged("GLPARTIEKZ", value); } } //lENGth 1
                 public double GLENTDAT { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLENTDAT"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLENTDAT"] = value; OnPropertyChanged("GLENTDAT", value); } } //lENGth 0
                 public double GLENTZEIT { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLENTZEIT"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLENTZEIT"] = value; OnPropertyChanged("GLENTZEIT", value); } } //lENGth 0
                 public double GLAENDZL { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLAENDZL"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLAENDZL"] = value; OnPropertyChanged("GLAENDZL", value); } } //lENGth 0
                 public string GLAUFBKZ { get { if (dwMaster == null) return ""; return dwMaster["GLAUFBKZ"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLAUFBKZ"] = value; OnPropertyChanged("GLAUFBKZ", value); } } //lENGth 1
                 public string GLTEILNR { get { if (dwMaster == null) return ""; return dwMaster["GLTEILNR"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLTEILNR"] = value; OnPropertyChanged("GLTEILNR", value); } } //lENGth 4
                 public string GLABZUGKZ1 { get { if (dwMaster == null) return ""; return dwMaster["GLABZUGKZ1"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLABZUGKZ1"] = value; OnPropertyChanged("GLABZUGKZ1", value); } } //lENGth 1
                 public string GLABZUGKZ2 { get { if (dwMaster == null) return ""; return dwMaster["GLABZUGKZ2"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLABZUGKZ2"] = value; OnPropertyChanged("GLABZUGKZ2", value); } } //lENGth 1
                 public string GLABZUGKZ3 { get { if (dwMaster == null) return ""; return dwMaster["GLABZUGKZ3"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLABZUGKZ3"] = value; OnPropertyChanged("GLABZUGKZ3", value); } } //lENGth 1
                 public string GLABZUGKZ4 { get { if (dwMaster == null) return ""; return dwMaster["GLABZUGKZ4"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLABZUGKZ4"] = value; OnPropertyChanged("GLABZUGKZ4", value); } } //lENGth 1
                 public double GLINVDAT { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLINVDAT"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLINVDAT"] = value; OnPropertyChanged("GLINVDAT", value); } } //lENGth 0
                 public string GLHUELTYP { get { if (dwMaster == null) return ""; return dwMaster["GLHUELTYP"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLHUELTYP"] = value; OnPropertyChanged("GLHUELTYP", value); } } //lENGth 6
                 public double GLLAENGE { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLLAENGE"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLLAENGE"] = value; OnPropertyChanged("GLLAENGE", value); } } //lENGth 0
                 public string GLAUFMSL { get { if (dwMaster == null) return ""; return dwMaster["GLAUFMSL"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLAUFMSL"] = value; OnPropertyChanged("GLAUFMSL", value); } } //lENGth 2
                 public string GLSPSTA { get { if (dwMaster == null) return ""; return dwMaster["GLSPSTA"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLSPSTA"] = value; OnPropertyChanged("GLSPSTA", value); } } //lENGth 2
                 public string GLSPGRD { get { if (dwMaster == null) return ""; return dwMaster["GLSPGRD"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLSPGRD"] = value; OnPropertyChanged("GLSPGRD", value); } } //lENGth 2
                 public double GLSPDAT { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLSPDAT"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLSPDAT"] = value; OnPropertyChanged("GLSPDAT", value); } } //lENGth 0
                 public string GLPSTART { get { if (dwMaster == null) return ""; return dwMaster["GLPSTART"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLPSTART"] = value; OnPropertyChanged("GLPSTART", value); } } //lENGth 4
                 public string GLPACKNR { get { if (dwMaster == null) return ""; return dwMaster["GLPACKNR"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLPACKNR"] = value; OnPropertyChanged("GLPACKNR", value); } } //lENGth 4
                 public string GLURLB { get { if (dwMaster == null) return ""; return dwMaster["GLURLB"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLURLB"] = value; OnPropertyChanged("GLURLB", value); } } //lENGth 2
                 public string GLURLP { get { if (dwMaster == null) return ""; return dwMaster["GLURLP"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLURLP"] = value; OnPropertyChanged("GLURLP", value); } } //lENGth 8
                 public string GLURAKZ { get { if (dwMaster == null) return ""; return dwMaster["GLURAKZ"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLURAKZ"] = value; OnPropertyChanged("GLURAKZ", value); } } //lENGth 1
                 public string GLZUSTAND { get { if (dwMaster == null) return ""; return dwMaster["GLZUSTAND"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLZUSTAND"] = value; OnPropertyChanged("GLZUSTAND", value); } } //lENGth 4
                 public double GLUBDAT { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLUBDAT"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLUBDAT"] = value; OnPropertyChanged("GLUBDAT", value); } } //lENGth 0
                 public double GLUBZEIT { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLUBZEIT"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLUBZEIT"] = value; OnPropertyChanged("GLUBZEIT", value); } } //lENGth 0
                 public string GLOWNER { get { if (dwMaster == null) return ""; return dwMaster["GLOWNER"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLOWNER"] = value; OnPropertyChanged("GLOWNER", value); } } //lENGth 8
                 public string GLINVOICE { get { if (dwMaster == null) return ""; return dwMaster["GLINVOICE"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLINVOICE"] = value; OnPropertyChanged("GLINVOICE", value); } } //lENGth 8
                 public string GLINVOICEPOS { get { if (dwMaster == null) return ""; return dwMaster["GLINVOICEPOS"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLINVOICEPOS"] = value; OnPropertyChanged("GLINVOICEPOS", value); } } //lENGth 3
                 public string GLPRODLO { get { if (dwMaster == null) return ""; return dwMaster["GLPRODLO"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLPRODLO"] = value; OnPropertyChanged("GLPRODLO", value); } } //lENGth 2
                 public double GLPRODDAT { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLPRODDAT"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLPRODDAT"] = value; OnPropertyChanged("GLPRODDAT", value); } } //lENGth 0
                 public double GLKOND { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLKOND"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLKOND"] = value; OnPropertyChanged("GLKOND", value); } } //lENGth 0
                 public string GLTEXTSL { get { if (dwMaster == null) return ""; return dwMaster["GLTEXTSL"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLTEXTSL"] = value; OnPropertyChanged("GLTEXTSL", value); } } //lENGth 2
                 public string GLCARRIER { get { if (dwMaster == null) return ""; return dwMaster["GLCARRIER"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLCARRIER"] = value; OnPropertyChanged("GLCARRIER", value); } } //lENGth 8
                 public string GLCARRPOS { get { if (dwMaster == null) return ""; return dwMaster["GLCARRPOS"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLCARRPOS"] = value; OnPropertyChanged("GLCARRPOS", value); } } //lENGth 3
                 public double GLCARRNOPA { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLCARRNOPA"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLCARRNOPA"] = value; OnPropertyChanged("GLCARRNOPA", value); } } //lENGth 0
                 public string GLURLAND { get { if (dwMaster == null) return ""; return dwMaster["GLURLAND"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLURLAND"] = value; OnPropertyChanged("GLURLAND", value); } } //lENGth 3
                 public string GLVERZKZ { get { if (dwMaster == null) return ""; return dwMaster["GLVERZKZ"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLVERZKZ"] = value; OnPropertyChanged("GLVERZKZ", value); } } //lENGth 1
                 public string GLMNRKRS { get { if (dwMaster == null) return ""; return dwMaster["GLMNRKRS"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLMNRKRS"] = value; OnPropertyChanged("GLMNRKRS", value); } } //lENGth 2
                 public string GLMLFDNR { get { if (dwMaster == null) return ""; return dwMaster["GLMLFDNR"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLMLFDNR"] = value; OnPropertyChanged("GLMLFDNR", value); } } //lENGth 4
                 public string GLMPOS { get { if (dwMaster == null) return ""; return dwMaster["GLMPOS"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLMPOS"] = value; OnPropertyChanged("GLMPOS", value); } } //lENGth 2
                 public string GLSCHICHT { get { if (dwMaster == null) return ""; return dwMaster["GLSCHICHT"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLSCHICHT"] = value; OnPropertyChanged("GLSCHICHT", value); } } //lENGth 1
                 public string GLKONDKZ { get { if (dwMaster == null) return ""; return dwMaster["GLKONDKZ"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLKONDKZ"] = value; OnPropertyChanged("GLKONDKZ", value); } } //lENGth 1
                 public double GLIKOND { get { if (dwMaster == null) return 0.0; return  Convert.ToDouble(dwMaster["GLIKOND"].ToString()); } set { if (dwMaster == null) return; dwMaster["GLIKOND"] = value; OnPropertyChanged("GLIKOND", value); } } //lENGth 0
                 public string GLPOSTYP { get { if (dwMaster == null) return ""; return dwMaster["GLPOSTYP"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLPOSTYP"] = value; OnPropertyChanged("GLPOSTYP", value); } } //lENGth 3
                 public string GLFILLER1 { get { if (dwMaster == null) return ""; return dwMaster["GLFILLER1"].ToString(); } set { if (dwMaster == null) return; dwMaster["GLFILLER1"] = value; OnPropertyChanged("GLFILLER1", value); } } //lENGth 39
        */
        #endregion
    }
}
